﻿using ExpenseSystem.Common;
using ExpenseSystem.Common.BaseModel;
using ExpenseSystem.Core.Authority;
using ExpenseSystem.Core.Converter;
using ExpenseSystem.Core.ProductionModules;
using ExpenseSystem.Fether;
using ExpenseSystem.Model;
using System.Web.Http;

namespace ExpenseSystem.Controllers
{
    [RoutePrefix("api/Bland")]

    public class BlandController : ApiController
    {
        readonly SetInhibition setInhibition;
        readonly GetInhibition getInhibition;
        SetInhibitionMaker inhibitionMaker = new StateInhibitionMaker();
        GetInhibitionMaker getInhibitionMaker = new GetInhibitionMaker();
        public BlandController()
        {
            setInhibition = inhibitionMaker.Make();
            getInhibition = getInhibitionMaker.Make();
        }

        readonly BlandFetcher fetcher = new BlandFetcher();
        readonly BlandManager manager = new BlandManager();

        [Route("List")]
        [HttpGet]
        public ResponseModel List([FromUri]RequestArgs paramModels)
        {
            return NormalControllerHelper.List(fetcher, "BAS_PRODUCTION_LIST", paramModels, getInhibition);
        }
        [Route("Get")]
        [HttpGet]
        public ResponseModel Get(long id)
        {
            return NormalControllerHelper.Get(fetcher, "BAS_PRODUCTION_LIST", id, getInhibition);
        }

        [Route("Set")]
        [HttpPost]
        public ResponseModel Set(BlandModel data)
        {
            return NormalControllerHelper.Set(fetcher, "BAS_PRODUCTION_SET", data, manager, setInhibition,getInhibition);
        }

        [Route("Remove")]
        [HttpPost]
        public ResponseModel Remove(BlandModel data)
        {
            return NormalControllerHelper.Remove("BAS_PRODUCTION_DEL", data, manager);
        }

        [Route("RemoveById")]
        [HttpGet]
        public ResponseModel RemoveById([FromUri]long[] id)
        {
            return NormalControllerHelper.RemoveById("BAS_PRODUCTION_DEL", id, manager);
        }
    }
}
